<?php
    require_once("include/game_core.php");
    require_once(DB_FILE);
    require_once(USER_CONTROLLER_FILE);
    require_once(GAME_INIT_FILE);
    
    // first access this page only if logged it
    if ( ! UserController::isLoggedIn() ) {
        die();
    }   
    
    // check if already waiting
    if ( UserController::isWatingForGame() ) {  //set by the WaitingRoom in the first time  
        GameInit::CancelWaiting();
        header( 'Location: index.php' ) ;
    }  
    else {
        die();
    }